package com.tuzhi.sys.jpa.repository;

import com.tuzhi.base.jpa.repository.BaseRepo;
import com.tuzhi.sys.jpa.entity.RoleMenuEntity;
import com.tuzhi.sys.jpa.entity.pk.RoleMenuPk;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface RoleMenuViewRepo extends BaseRepo<RoleMenuEntity, RoleMenuPk> {
    @Query("select perms from RoleMenuEntity where roleId=:roleId and roleStatus=0 and menuStatus=0")
    List<String> loadPerms4Role(@Param("roleId") Long roleId);

    @Query("select perms from RoleMenuEntity where roleName=:roleName and roleStatus=0 and menuStatus=0")
    List<String> loadPerms4Role(@Param("roleName") String roleName);

    @Query("select url from RoleMenuEntity where roleId=:roleId and roleStatus=0 and menuStatus=0")
    List<String> loadUrls4Role(@Param("roleId") Long roleId);

    @Query("select url from RoleMenuEntity where roleName=:roleName and roleStatus=0 and menuStatus=0")
    List<String> loadUrls4Role(@Param("roleName") String roleName);

}
